<div class="row justify-content-center">
    <div class="col-8">
        <form name="editForm" role="form" novalidate (ngSubmit)="save()" [formGroup]="editForm">
            <h2 id="jhi-job-heading">Create or edit a Job</h2>

            <div>
                <jhi-alert-error></jhi-alert-error>

                <div class="form-group" [hidden]="!editForm.get('id')!.value">
                    <label for="id">ID</label>
                    <input type="text" class="form-control" id="id" name="id" formControlName="id" readonly />
                </div>

                <div class="form-group">
                    <label class="form-control-label" for="field_jobTitle">Job Title</label>
                    <input type="text" class="form-control" name="jobTitle" id="field_jobTitle"
                           formControlName="jobTitle"/>
                </div>

                <div class="form-group">
                    <label class="form-control-label" for="field_minSalary">Min Salary</label>
                    <input type="number" class="form-control" name="minSalary" id="field_minSalary"
                           formControlName="minSalary"/>
                </div>

                <div class="form-group">
                    <label class="form-control-label" for="field_maxSalary">Max Salary</label>
                    <input type="number" class="form-control" name="maxSalary" id="field_maxSalary"
                           formControlName="maxSalary"/>
                </div>

                <div class="form-group">
                    <label for="field_tasks">Task</label>
                    <select class="form-control" id="field_tasks" multiple name="tasks" formControlName="tasks">
                        <option [ngValue]="getSelected(editForm.get('tasks')!.value, taskOption)" *ngFor="let taskOption of tasks; trackBy: trackById">{{ taskOption.title }}</option>
                    </select>
                </div>

                <div class="form-group">
                    <label class="form-control-label" for="field_employee">Employee</label>
                    <select class="form-control" id="field_employee" name="employee" formControlName="employeeId">
                        <option [ngValue]="null"></option>
                        <option [ngValue]="employeeOption.id" *ngFor="let employeeOption of employees; trackBy: trackById">{{ employeeOption.id }}</option>
                    </select>
                </div>
            </div>

            <div>
                <button type="button" id="cancel-save" class="btn btn-secondary" (click)="previousState()">
                    <fa-icon icon="ban"></fa-icon>&nbsp;<span>Cancel</span>
                </button>

                <button type="submit" id="save-entity" [disabled]="editForm.invalid || isSaving" class="btn btn-primary">
                    <fa-icon icon="save"></fa-icon>&nbsp;<span>Save</span>
                </button>
            </div>
        </form>
    </div>
</div>
